home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 October / Macformat17.cdr / Shareware City / Developers / WASTETCL / Readme
Encoding:
Text File  |  1994-07-02  |  5.3 KB  |  113 lines  |  [TEXT/OEDE]

  1. CWASTEText Classes
  2. A set of classes for using WASTE with the Think Class Libraries
  3. by Dan Crevier
  4.  
  5. Introduction
  6.  
  7.     This is a set of classes I've written to use Marco Piovanelli's text edit replacement WASTE with the Think Class Libraries.  It only works with versions 2.0.3 or newer of TCL.  It has currently been tested with WASTE 1.0a4.
  8.  
  9.      I wanted to use WASTE in one of my applications mainly for the ability to use more than 32K of text, and to use inline input for Japanese.  The classes are not well tested at this point, and probably contain many bugs.  I am releasing these classes as public domain, so you are free to use them as you see fit.  Remember to give Marco Piovanelli credit if you use WASTE, and you can give me some credit if you feel like it.  If you use these classes, I'd be very interested in any bug reports (especially if they include fixes) and any improvements anyone makes.  I'd like to thank Marco Piovanelli both for making WASTE available and for his help in figuring out how to get it to work with the class libraries.
  10.  
  11.     There are 3 classes included.  They are:
  12.      CWASTEText - a subclass of CAbstractText which is much like
  13.              CStyleText
  14.      CWASTEDlgText - a subclass of CWASTEText which is a bit like
  15.              CDialogText, but without all of the validation features.  It
  16.              has a border, broadcasts changes when the text changes,
  17.              and passes return, enter and escape to the supervisor.
  18.      CTSMSwitchboard - a subclass of CSwitchboard which deals
  19.              with Text Service Manager events.
  20.  
  21.      I also made some slight modifications to the WASTE header files.  Hopefully Marco will be able to include these in future versions of WASTE.
  22.  
  23.      I've also included a slightly modified version of TinyEdit, called WASTEEdit, which uses WASTE as a simple example program.
  24.  
  25. Adding WASTE Support
  26.  
  27.      If you wish to use these classes in your application, you need to add the following to your application class:
  28.  
  29.      Near the top:
  30.  
  31. #include "WASTE.h"
  32. #ifndef __SCRIPT__
  33. #include <Script.h>
  34. #endif
  35.  
  36. #include "CTSMSwitchboard.h"
  37.  
  38. static Boolean    TSMAvailable(void);
  39.  
  40. short gUsingTSM = false;
  41.  
  42.      In the constructor:
  43.  
  44.     gUsingTSM = TSMAvailable();
  45.     if (gUsingTSM) gUsingTSM = (InitTSMAwareApplication()==noErr);
  46.  
  47.      In the destructor:
  48.  
  49.     if (gUsingTSM) CloseTSMAwareApplication();
  50.  
  51.      Functions to add:
  52.  
  53. /*** make TSMSwitchboard ***/
  54. void CEditApp::MakeSwitchboard( void)
  55. {
  56.     if (gSystem.hasAppleEvents && gUsingTSM)
  57.     {
  58.         FailOSErr(WEInstallTSMHandlers());
  59.     }
  60.     itsSwitchboard = (CSwitchboard *)new CTSMSwitchboard();
  61.     itsSwitchboard->InitAppleEvents();
  62. }
  63.  
  64.  
  65. static Boolean TSMAvailable(void)
  66. {
  67.     long    response;
  68.     
  69.     return (Gestalt(gestaltTSMgrVersion, &response)==noErr);
  70. }
  71.  
  72.      To header file:
  73.  
  74. void MakeSwitchboard( void);
  75.  
  76.      See WASTEEdit for an example.  Most of this stuff is to provide inline input.  Even if you don't use Japanese on your system, I recommend leaving the support there for those that do have inline input.
  77.  
  78.      You need to add CTSMSwitchboard.cpp, CWASTEText.cpp, CWASTEDlgText.cpp, and WASTE.o to your project.
  79.  
  80. CWASTEText
  81.  
  82.      CWASTEText is a subclass of CAbstractText, and is very similar to CStyleText.  In addition, I have added the following functions:
  83.  
  84.      StopInlineSession() - Stops the current inline input session
  85.           and validates the text.
  86.      InsertWithStyle() - Lets you insert some text and it's
  87.           corresponding StScrpHandle information all in one step.
  88.      Clear() - clears the text in the class without any excess
  89.           highlighting.
  90.      CopyRangeWithStyle() - gets the text and styles for a range
  91.           of text all in one step.
  92.  
  93.      There are some problems with CWASTEText.  A lot of the functions haven't been tested well or at all.  Also, I should add some functions for easy color support.  TCL isn't good at supporting text without fixed height lines.  SetWholeLines(true) doesn't work well.  I set the scrolling steps to 12 vertically and 4 horizontally fow when it's in a scroll pane.  Something more intelligent could probably be done.
  94.      Note:  I haven't made an EditTask class for WASTE.
  95.  
  96. CWASTEDlgText
  97.  
  98.      CWASTEDlgText was made to provide some of the funcitonality of CDialogText.  A dialogTextChanged message is broadcast when the text is changed.  This wasn't easy for text being entered with inline input, but I think I have it working with a WEPostUpdate routine.  It may be broadcasting the message more often than it needs to, but that's ok with me.
  99.      It also has a border, just like CDialogText, and passes tab, return, enter, and escape to the supervisor instead of typing them.
  100.      I added the GetTextString() method to get the text into a Str255.
  101.  
  102. CTSMSwitchboard
  103.  
  104.      This is a subclass of CSwitchboard which handles Text Service Manager events.  I don't think it is calling TSMCursor as much as it should be though...
  105.  
  106. WASTEEdit
  107.  
  108.      WASTEEdit is a slightly modified version of TinyEdit to get it to work with WASTE.  I tried to do the minimum modifications necessary to get it to work, so I haven't added any functionality.  With a little work, I think a nice application could be made out of it.  Right now, it's almost 10 times as big as WASTE Demo, and doesn't do quite as much.  It would be really great if someone wanted to add all the scripting support to it, so we would have a nice replacement for the Scriptable Text Editor.
  109.  
  110.  
  111.  
  112.  
  113.